.device   ATmega8515
.nolist 
.include   "m8515def.inc"
.list


.def temp = r16

; FLASH ===========================================
.CSEG ;  

;======   ================

	 .ORG 0x0000 ; RESET -  
      RJMP Init
 	 .ORG 0x0001 ; INT0 - External Interrupt0 Vector Address;   0 ;
	  RETI 
     .ORG 0x0002 ; INT1 - External Interrupt1 Vector Address;   1 ;
	  RETI       ;   ,    
     .ORG 0x0003 ; ICP1 - Input Capture1 Interrupt Vector Address;   / 1  ;
	  ;RETI
     .ORG  0x0004 ;OC1Aaddr; OC1A - Output Compare1A Interrupt Vector Address ; " A" / 1  ;
	  rjmp Sravnenie ;RETI
     .ORG 0x0005 ; OC1B - Output Compare1B Interrupt Vector Address;  " B" / 1  ;
	  RETI
     .ORG 0x0006 ; OVF1 - Overflow1 Interrupt Vector Address;  / 1  ;
	  rjmp perepolnenie;RETI
     .ORG 0x0007 ; OVF0 - Overflow0 Interrupt Vector Address;  / 0  ;
	  RETI
     .ORG 0x0008 ; SPI  - SPI Interrupt Vector Address;    SPI 
	  RETI
     .ORG 0x0009 ; URXC - UART Receive Complete Interrupt Vector Address;    UART 
	  RETI;RJMP RX_OK ;    
     .ORG 0x000a ; UDRE - UART Data Register Empty Interrupt Vector Address;   UART 
	  RETI
     .ORG 0x000b ; UTXC - UART Transmit Complete Interrupt Vector Address;    UART 
	  reti;
     .ORG 0x000c ; ACI  - Analog Comparator Interrupt Vector Address;    
	  RETI
     .ORG 0x000d ; INT2  - External Interrupt2 Vector Address
	  RETI
     .ORG 0x000e ; OC0 - Output Compare0 Interrupt Vector Address
	  RETI
     .ORG 0x000f ; ERDY -  EEPROM Interrupt Vector Address
	  RETI
     .ORG 0x0010 ; SPM - SPM complete Interrupt Vector Address
	  RETI
     ;.ORG 0x0011 ; SPMR - SPM complete Interrupt Vector Address
	 ; RETI

    ; .ORG INT_VECTORS_SIZE 

;================ ;    ===

;============     ===========
Sravnenie:
in temp, PortB
eor temp,r17
out PortB,temp
reti

perepolnenie:
in temp, PortB
eor temp,r18
out PortB,temp
reti

;================
 Init:cli     ;   
;++++++++++++++   INITCORE.INC +++++++++++++++++++++++++
;====  : ; ;  =============
.include "INITCORE.inc"
;++++++++++++++    INITCORE.INC +++++++++++++++++
;================
  
ldi temp , 0b11111111  ;  \  , 
out DDRB , temp        ; 1   , 0 - !
ldi temp , 0b00000000  ;  \  D
out DDRD , temp

ldi temp , 0b11111111  ;   (1)     
out portB , temp       ;     
ldi temp , 0b11111111  ;     D
out portD , temp

ldi temp , 0b00001101 ;   T\C1 
out TCCR1B,temp		  ; (CTC)   

ldi temp, 0xFF
out OCR1AL,temp
ldi temp, 0xFF
out OCR1AH,temp

ldi temp,( 1<<OCIE1A)   ;    
out TIMSK,temp

ldi r17 , 0b00000010
ldi r18 , 0b00000100
ldi r19 , 0b00001000

;================
;   
Start: 
sei
Start1:
nop
rjmp Start1;
